#define _CRT_SECURE_NO_WARNINGS 1
class Date {
public:
	Date(int year, int month, int day) {
		_year = year;
		_month = month;
		_day = day;
	}
	void Print() const {
		printf("%d-%d-%d\n", _year, _month, _day);
	}

	void operator<<(ostream& out);

private:
	int _year;
	int _month;
	int _day;
};

#include "Date.h"

int main(void)
{
	Date d1(2022, 3, 20);
	// cout << d1;  ❌ 不识别，调不动

	d1 << cout;  // d1.operator<<(cout);

	return 0;
}

class Date {
public:
	friend void operator<<(ostream& out, const Date& d);  // 友元的声明
	//...

private:
	int _year;
	int _month;
	int _day;
};